dotnet6/web/{{cookiecutter.project_name}}/template.yaml (49 lines of code) (raw):
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
Sample SAM Template for {{cookiecutter.project_name}}
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 100
Resources:
NetCodeWebAPIServerless:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
Description: A simple example includes a .NET Core WebAPI App with DynamoDB table.
CodeUri: ./src/ServerlessAPI/
Handler: ServerlessAPI
Runtime: dotnet6
MemorySize: 1024
Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
Variables:
SAMPLE_TABLE: !Ref SampleTable
Policies:
# Give Create/Read/Update/Delete Permissions to the SampleTable
- DynamoDBCrudPolicy:
TableName: !Ref SampleTable
Events:
ProxyResource:
Type: HttpApi
Properties:
PayloadFormatVersion: "2.0"
Path: /{proxy+}
Method: ANY
RootResource:
PayloadFormatVersion: "2.0"
Type: HttpApi
Properties:
Path: /
Method: ANY
# DynamoDB table to store item: {id: <ID>, name: <NAME>}
SampleTable:
Type: AWS::Serverless::SimpleTable
Properties:
TableName: {{cookiecutter.project_name}}BookCatalog
PrimaryKey:
Name: Id
Type: String
ProvisionedThroughput:
ReadCapacityUnits: 2
WriteCapacityUnits: 2
Outputs:
WebEndpoint:
Description: "API Gateway endpoint URL"
Value: !Sub "https://${ServerlessHttpApi}.execute-api.${AWS::Region}.amazonaws.com/"